home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 853 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: cs.mu.OZ.AU!bounce-back
  2. From: abell@mindspring.com (Andrew Bell)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: constness of private members and methods
  5. Date: 26 Mar 96 07:19:43 GMT
  6. Organization: MindSpring Enterprises
  7. Approved: fjh@cs.mu.oz.au
  8. Message-ID: <4j7tfi$1npo@mule1.mindspring.com>
  9. References: <4j49e0$8fo@dub-news-svc-4.compuserve.com>
  10. NNTP-Posting-Host: munta.cs.mu.oz.au
  11. X-Original-Date: Tue, 26 Mar 1996 04:59:54 GMT
  12. X-Newsreader: Forte Agent .99.82
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBFAgUBMVeamuEDnX0m9pzZAQFmkAF9E61+BQ+dorfTWX9YInA+sxWhuGLapLk4
  15.     BTS4cRzHRKHRSzuXFQKhk0kHuwEZTWB7
  16.     =2gwE
  17. Originator: fjh@munta.cs.mu.OZ.AU
  18.  
  19. Philippe Verdy <100105.3120@compuserve.com> wrote:
  20.  
  21. >Many recursive data structures require algorithms to handle
  22. >them which have to mark and unmark all scanned objects in
  23. >order to avoid infinite recursion when walking on that
  24. >structure, or when building items iterator.
  25.  
  26. The property of being marked is really part of your algorithm, not
  27. part of the object itself.  You should consider making some sort of
  28. separate record (a list of some sort) to indicate which items are
  29. marked and unmarked.  Otherwise, you'll then find an algorithm where
  30. you have to mark things twice, and so on...
  31.  
  32. >Is there any way (or proposal) to explicitly specify members
  33. >of a class definition which are relaxed on constness certi-
  34. >fication ?
  35.  
  36. Sounds like "mutable" to me.
  37.  
  38. >And is constness definition a semantic only definition,
  39.  
  40. Being const means only that the current function won't change the
  41. object, not that the object itself won't change during the function.
  42. It could change as the result of a side effect of another function
  43. called within the current one.  Thus unless only inline or other
  44. internally known functions are called, no additional optimizations are
  45. possible.
  46.  
  47. Andrew Bell
  48. abell@mindspring.com
  49. ---
  50. [ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
  51. [ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
  52. [ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
  53. [ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
  54. [ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
  55.